package com.dfbz.netctoss.service.impl;

import com.dfbz.netctoss.entity.Account;
import com.dfbz.netctoss.mapper.AccountMapper;
import com.dfbz.netctoss.service.AccountService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class AccountServiceImpl implements AccountService {

    @Autowired
    AccountMapper mapper;

    @Override
    public PageInfo<Account> selectPage(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Account> accounts = mapper.selectAll();
        return new PageInfo<>(accounts);
    }

    @Override
    public Account findByAId(int id) {
        return mapper.findByAId(id);
    }
}
